package cn.yuxiaoyuan.fallback;

import cn.yuxiaoyuan.feign.LoginFeignApi;
import cn.yuxiaoyuan.pojo.dto.LoginDto;
import cn.yuxiaoyuan.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author solargen
 * @version 1.0
 * @date 2025/6/16 11:24
 */
@Component
public class LoginFeignApiFallback implements FallbackFactory<LoginFeignApi> {
    @Override
    public LoginFeignApi create(Throwable cause) {
        return new LoginFeignApi() {
            @Override
            public JSONResult create(LoginDto loginDto) {
                return JSONResult.error("服务调用失败");
            }
        };
    }
}
